import {Key} from "react"
import type { 
  getHosSetListParamsType,
  getHosSetListReturnType,
  addHospitalParamType ,
  getHosSetListItemsType,
  updateHospitalParamType
} from './model/hospitalSetTypes';
import { request } from "@/utils/http";


// 医院设置中  获取分页列表
export const  getHosSetListRequest=({page,limit,hosname,hoscode}:getHosSetListParamsType)=>{
  // 注意类型声明也需要一一对应,不能只传一个值
    return request.get<any,getHosSetListReturnType>(`/admin/hosp/hospitalSet/${page}/${limit }`,{
      params:{
        hosname,
        hoscode
      }
    })
}
// 医院设置中  新增医院请求
export const addhosListRequest=(data:addHospitalParamType)=>{
  return request.post<any,null>("/admin/hosp/hospitalSet/save",data)
}

// 医院设置中  根据id获取某个详细的医院设置
export const getHosSetFormIdRequest=(id:string)=>{
  return request.get<any,getHosSetListItemsType>(`/admin/hosp/hospitalSet/get/${id}`)
}

//医院设置中 根据id修改数据后，再次提交修改
export const updateHosSetFromIdRequest = (data: updateHospitalParamType) => {
  return request.put<any, null>("/admin/hosp/hospitalSet/update", data)
}

// 医院设置中  点击删除按钮  根据id删除某条数据
export const deleteHosSetIdRequest=(id:number)=>{
  return request.delete<any,null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

// 医院设置中 批量删除请求
export const  batchdeleteIdsRequest=(ids:Key[])=>{
  return request.delete<any,null>("/admin/hosp/hospitalSet/batchRemove",{
    data:ids
  })
}